package com.ithappy.oop;
/*
* 测试组合
* */
public class TestComponent {
    public static void main(String[] args) {
        Student02 a1 = new Student02("wyw",165,"software engeneering");
        a1.study();
        System.out.println(a1.major);
    }
}

class Person02{
    String name;
    int height;
    public void rest(){
        System.out.println("休息！");
    }
    public int getHeight(){
        return height;
    }
}

class Student02{
    Person02 person02 = new Person02();

    String major;
    public void study(){
        System.out.println("学习！");
        person02.rest();
        System.out.println(this.person02.name);
        System.out.println(this.person02.height);
    }

    public Student02(String name,int height,String major){
        this.person02.name = name;
        this.person02.height = height;
        this.major = major;
    }

    public int getStudentHeight(){
        return person02.getHeight();
    }
}